<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/jquery-weui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/index.css" />
		<link rel="stylesheet" type="text/css" href="../../css/mine.css" />
		<link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_546019_o8qxm6fupb0ggb9.css" />
		<title>过磅单信息</title>
		<script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/baseConfig.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<!--<div id="header">
			<div class="header-title" style="position: fixed;top: 0;border-bottom: 0;">
				<img src="../../img/left.png" class="left" />
				<span>过磅单信息</span>
			</div>
		</div>-->
		<div class="pinderation" style="margin-top: 0;">
			<div class="identity-type">
				<span>基本信息</span>
			</div>
			<div class="essen_list">
				<p>
					<span>车牌号</span>
					<b class="carNo"></b>
				</p>
				<p>
					<span>司机姓名</span>
					<b class="driver"></b>
				</p>
				<p>
					<span>司机电话</span>
					<b class="phone"></b>
				</p>
				<p>
					<span>入场时间</span>
					<b class="time"></b>
				</p>
			</div>
			<div class="identity-type">
				<span>物料详情</span>
				<span style="float: right;padding-right: 1.1rem;">单位(吨)</span>
			</div>
			<table border="0" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<th>物料<br />名称</th>
						<th>装车<br />重量</th>
						<th>物料过<br />磅重量</th>
						<th>重量<br />误差</th>
					</tr>
				</thead>
				<tbody>
					
				</tbody>
				<tfoot>
					
				</tfoot>
			</table>
			<div class="seePonderation">
				<a href="javascript:;" class="seeClick">查看过磅单</a>
				<div class="demos-content-padded">
					<a href="javascript:;" class="weui-btn weui-btn_primary">确认重量无误</a>
				</div>

			</div>

		</div>

	</body>
	<script type="text/javascript">
		$(document).ready(function() {
			baseConfig.historyBack()
			$.showLoading("加载中...");
			$.ajax({
				type: "get",
				url: baseConfig.localHttp + "weChatApi/fgclient/viewPoundList",
				async: false,
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
				data: {
					carNo: baseConfig.GetQueryString("carNo"),
					orderNo: baseConfig.GetQueryString("orderNo")
				},
				success: function(data) {
					$.hideLoading();
					console.log(data)
					var status = baseConfig.GetQueryString("status")
					var dataStatus = baseConfig.GetQueryString("dataStatus")
					if(status==1 || dataStatus==1){
						$(".demos-content-padded").hide()
					}else{
						$(".demos-content-padded").show()
					}
					if(data.code == 100) {
						var fgTranInfo = data.content.fgTranInfo;
						var fgGoodslist = data.content.fgGoodslist;
						var carId = fgTranInfo.id
						var $tr = ""
						var a=b=c=0
						$(".carNo").html(fgTranInfo.carPlateNo);
						$(".driver").html(fgTranInfo.carDriverName);
						$(".phone").html(fgTranInfo.carDriverMobile)
						$(".time").html(fgTranInfo.enterTimeStr)
						for(var i=0;i<fgGoodslist.length;i++){
							$tr += "<tr><td>"+fgGoodslist[i].goodsName+"</td><td>"+fgGoodslist[i].goodsCarWeight+"</td><td>"+fgGoodslist[i].goodsWeight+"</td><td>"+fgGoodslist[i].weightWucha+"</td></tr>"
							a += fgGoodslist[i].goodsCarWeight*1
							b += fgGoodslist[i].goodsWeight*1
							c += fgGoodslist[i].weightWucha*1					
						}
						$("tfoot").html("<tr><td>物料合计</td><td>"+a.toFixed(3)+"</td><td>"+b.toFixed(3)+"</td><td>"+c.toFixed(3)+"</td></tr>")
						$("tbody").append($tr)
					} else {
						$.toptip(data.content, 1200, 'error');
					}
					$(".seeClick").on("click", function() {
						location.href = "LookPonderation.html?carNo=" + baseConfig.GetQueryString("carNo") + "&orderNo=" + baseConfig.GetQueryString("orderNo")+"&carId="+carId
					})
				},
				error: function() {
					$.hideLoading();
					$.toast("请求失败", "cancel");
				}
			})
			//确认过磅单重量
			if(baseConfig.GetQueryString("enterStatus")==1){
				$(".weui-btn").hide()
			}else{
			$(".weui-btn").on("click", function() {
				$.ajax({
					type: "get",
					url: baseConfig.localHttp + "weChatApi/fgclient/confirmPound",
					async: false,
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					data: {
						clientId: baseConfig.login(),
						orderNo: baseConfig.GetQueryString("orderNo"),
						carNo:baseConfig.GetQueryString("carNo")
					},
					success: function(data) {
						console.log(data)
						if(data.code == 100) {
							$.toptip(data.content, 1200, 'success');
							location.href = "mine.html"
						} else {
							$.toptip(data.content, 1200, 'error');
						}
					},
					error: function() {
						$.hideLoading();
						$.toast("请求失败", "cancel");
					}
				})
			})
			}
		})
	</script>

</html>